package com.mg.game.content;

import com.mg.framework.kernel.GameApplication;
import com.mg.framework.kernel.MG;
import com.mg.game.base.LogoScreen;
import com.mg.game.content.gamescreen.GameScreen;
import com.mg.game.content.tasksscreen.TaskManager;
import com.mg.game.content.tasksscreen.TasksScreen;

public class TankGame extends GameApplication {

	private TaskManager taskManager;

	public TankGame(MG mg) {
		super(mg);
		TankGameAssets.loadingInitAssets();
		this.setInitScreen("logoScreen", LogoScreen.class);
	}

	public void toTasksScreen() {
		if (this.getScreen("tasks") == null) {
			TasksScreen screen = (TasksScreen) this.newScreen("tasks",
					TasksScreen.class);
			this.taskManager = new TaskManager(screen);
		}
		this.changeScreen("tasks");
	}

	public void toGameScreen(int taskIndex) {
		GameScreen gameScreen = (GameScreen) this.getScreen("game");
		if (gameScreen == null) {
			gameScreen = (GameScreen)this.newScreen("game", GameScreen.class);
		}
		taskManager.startTask(gameScreen,taskIndex);
		this.changeScreen("game");
	}
}
